import JoyStick, { IJoyStickType } from "./JoyStick";
import { JoyStickTypeBase } from "./TypeBase";

export default class JoyStickTypeFixed extends JoyStickTypeBase implements IJoyStickType {
    constructor(stick: JoyStick) {
        super(stick)
    }
    touchStartEvent(event: cc.Event.EventTouch): boolean {
        const touchPos = this._stick.node.convertToNodeSpaceAR(event.getLocation())
        this._stick.ring.getPosition(this._stick._stickPos)
        const distance = touchPos.sub(this._stick._stickPos).mag()
        if (this._stick._radius > distance) {
            this._stick.dot.setPosition(touchPos);
        }
        return true
    }
    touchMoveEvent(event: cc.Event.EventTouch): boolean {
        return true
    }
    touchEndEvent(event: cc.Event.EventTouch): boolean {
        return true
    }
    init() {
    }
}
